#include <stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  
  int arr[n];

  for(int i = 0;i < n;i++){
    scanf("%d",&arr[i]);
  }

  int t = 0;
  int temp = 0;
  for(int i = 0;i < n-1;i++){
    t = i;
    for(int j = i+1;j < n;j++){
      if(arr[j]<arr[t])
        t = j;
    }
    temp = arr[i];
    arr[i] = arr[t];
    arr[t] = temp;

    for(int j = 0;j < n;j++){
      printf("%d ",arr[j]);
    }
    printf("\n");
  }
}
